home *** CD-ROM | disk | FTP | other *** search
/ TeX 1995 July / TeX CD-ROM July 1995 (Disc 1)(Walnut Creek)(1995).ISO / macros / plain / contrib / samples / verbatim_1.tex < prev    next >
Encoding:
Text File  |  1989-11-22  |  2.1 KB  |  57 lines

  1. %                       ttbar.tex
  2.  
  3.  
  4. %       Lifted from TUGBOT.STY.
  5. %
  6. %       Support verbatim listing of TeX source, as defined in TeXbook, p. 421;
  7. %       lifted from MANMAC.TEX, and modified slightly for narrower columns.
  8.  
  9. \chardef\other=12
  10. \def\ttverbatim{\begingroup \catcode`\\=\other
  11.   \catcode`\{=\other \catcode`\}=\other \catcode`\$=\other
  12.   \catcode`\&=\other \catcode`\#=\other \catcode`\%=\other
  13.   \catcode`\~=\other \catcode`\_=\other \catcode`\^=\other
  14.   \catcode`\"=\other
  15.   \obeyspaces \obeylines \tt}
  16.  
  17. \newskip\ttglue
  18. {\tenpoint\tt \global\ttglue=.5em plus .25em minus .15em}
  19. % this should be installed in each font
  20.  
  21. %       From David Eppstein's ``Trees'' paper (6#1), preserve initial spaces.
  22. {\obeyspaces\gdef {\ifvmode\indent\fi\space}}
  23.  
  24. \newdimen\ttrightskip
  25. \ttrightskip=5pc
  26.    
  27. \newif\ifttVertChar     \ttVertCharfalse
  28. {\catcode`\|=\active \gdef\VertChar{\def|{\char"7C }}}
  29.  
  30. %\outer\def\begintt{$$\let\par=\endgraf \ttverbatim \parskip=\z@
  31. \outer\def\begintt{$$\def\par{\leavevmode\null\endgraf}\ttverbatim \parskip=\z@
  32.   \ifttVertChar \VertChar \global\ttVertCharfalse \else \catcode`\|=0 \fi
  33.   \catcode`\|=0 \rightskip=-\ttrightskip \ttfinish}
  34. {\catcode`\|=0 |catcode`|\=\other % | is temporary escape character
  35.   |obeylines % end of line is active
  36.   |gdef|ttfinish#1^^M#2\endtt{#1|vbox{#2}|endgroup$$}}
  37.  
  38. %       Other non-tt elements that may be embedded within \begintt...\endtt .
  39. \def\MTH{$}
  40. \def\sb{_}
  41. \def\sp{^}
  42. \def\SP{{\tt\char"20 }}         % "visible" space
  43. \chardef\bs=`\\
  44. \def\vrt{{\tt\char`\|}}
  45.  
  46. \catcode`\|=\active
  47. %{\obeylines \gdef|{\ttverbatim \spaceskip\ttglue \let^^M=\  \let|=\endgroup}}
  48. {\obeylines \gdef\activatettbar{\global\catcode`\|=\active %
  49.   \gdef|{\ttverbatim \spaceskip\ttglue \xspaceskip\ttglue %
  50.          \let^^M=\  \let|=\endgroup}}}
  51. \activatettbar
  52.  
  53. %       The active | (which here implements verbatim mode) is redefined in
  54. %       such headers as TABLES.TeX and must be able to be reinstated.
  55. %       \activatettbar been tested with TABLES.TeX, and the two uses are
  56. %       mutually operable (TUGboat 7#2, "Tables in INRSTeX").
  57.